passthrough: fix MSI-X table fixmap allocation
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 17 Feb 2009 11:06:16 +0000 (11:06 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 17 Feb 2009 11:06:16 +0000 (11:06 +0000)
commite37e2388799a90538f5a57e847a2bb31740d7ffa
tree2da9c85e1e9e0873dd6182ee06ba9bde9b2b16b7
parentf3c727b3249c89478ee0b3ad727207efd4dd8141
passthrough: fix MSI-X table fixmap allocation

Currently, msix table pages are allocated a fixmap page per vector,
the available fixmap pages will be depleted when assigning devices
with large number of vectors.  This patch fixes it, and a bug that
prevents cross-page MSI-X table from working properly

It now allocates msix table fixmap pages per device, if the table
entries of two msix vectors share the same page, it will only be
mapped to fixmap once. A ref count is maintained so that it can
be unmapped when all the vectors are freed.

Also changes the meaning of msi_desc->mask_base from the va of msix
table start to the va of the target entry. The former one is currently
buggy (it always maps the first page but msix can support up to 2048
entries) and can't handle separately allocated pages.

Signed-off-by: Qing He <qing.he@intel.com>
xen/arch/x86/msi.c
xen/drivers/passthrough/pci.c
xen/include/asm-x86/fixmap.h
xen/include/asm-x86/msi.h
xen/include/xen/pci.h